package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppPaymentRecord;
import com.ep.modules.app.service.AppPaymentRecordService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/payment_record")
public class AppPaymentRecordController {
    @Autowired
    private AppPaymentRecordService appPaymentRecordService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appPaymentRecordService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppPaymentRecord apppaymentrecord = appPaymentRecordService.getById(id);
        return R.ok().put("apppaymentrecord", apppaymentrecord);
    }

    @SysLog("保存AppPaymentRecord")
    @PostMapping("/save")
    public R save(@RequestBody AppPaymentRecord apppaymentrecord) {
        ValidatorUtils.validateEntity(apppaymentrecord);
        appPaymentRecordService.save(apppaymentrecord);
        return R.ok();
    }

    @SysLog("修改AppPaymentRecord")
    @PostMapping("/update")
    public R update(@RequestBody AppPaymentRecord apppaymentrecord) {
        ValidatorUtils.validateEntity(apppaymentrecord);
        appPaymentRecordService.update(apppaymentrecord);
        return R.ok();
    }

    @SysLog("删除AppPaymentRecord")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appPaymentRecordService.deleteBatch(ids);
        return R.ok();
    }
}